package special_tree;

import java.util.List;

import code.CodeList;
import code.Opcode;
import lexer.Token;
import tree.ClassScope;
import tree.IdentifierScope;
import tree.MethodScope;
import tree.Modifiers;
import tree.MyTree;
import tree.NamingException;
import tree.Type;
import tree.TypingException;

public class GlobalDeclTree extends MyTree {

	@Deprecated
	private Type typ;
	@Deprecated
	private int InstVarNumber;
	
	public GlobalDeclTree(List<Modifiers> modifierList, Token ident,
			Type type, int numberOfInstVar) {
		super(ident);
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#analyzeNames(tree.IdentifierScope, tree.MethodScope, tree.ClassScope)
	 */
	@Override
	@Deprecated
	public void analyzeNames(IdentifierScope identScope,
			MethodScope methodScope, ClassScope classScope)
			throws NamingException {
		identScope.declare(this);
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#computeType()
	 */
	@Override
	@Deprecated
	public Type computeType() throws TypingException {
		return this.typ;
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#getInstVar()
	 */
	@Override
	@Deprecated
	public int getInstVar() {
		return this.InstVarNumber;
	}

	/* (non-Javadoc)
	 * @see tree.MyTree#generateCode(code.CodeList)
	 */
	@Override
	@Deprecated
	public void generateCode(CodeList code) {
		code.generateCode(Opcode.LDIC, getInstVar());
		code.generateCode(Opcode.SETVALUE);
	}

}
